package com.zc.servicedemo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class MonkeyUtils {
	
	public static void monkeyApp(String pName, int num) {
		StringBuilder command = new StringBuilder("monkey");
		command.append(" -p ").append(pName);
		command.append(" -v ").append(num);
		try {
			Process process = Runtime.getRuntime().exec(command.toString());
			InputStream is = process.getInputStream();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			System.out.println(br.readLine());
			System.out.println(command.toString());
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
